package org;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class PageTest {

    public static void main(String[] args) {

        List<Integer> itemList = new ArrayList<Integer>();
        for (int i = 1; i <= 100; i++) {
            int start = 100;
            itemList.add(start + i);
            start++;
        }
        System.out.println(itemList);

        System.out.println("*******************************************************************");

        int pageNumber = 1;
        int pageSize = 10;

        for (int i = 1; i <= 5; i++) {
            // 计算起始索引（从0开始）
            int startIndex = (pageNumber - 1) * pageSize;
            List<Integer> list = itemList.stream().skip(startIndex).limit(pageSize)
                    .collect(Collectors.toList());
            System.out.println("第【" + i + "】页数据：" + list);
            System.out.println("=============================================================");
            // 模拟第2页、第3页、.....等等
            pageNumber++;
        }
    }

}
